import { defineStore } from "pinia";

export const useUserStore = defineStore("user", () => {
  const userData = reactive({
    username: "",
    password: "",
  });
  function setLoginInfo(username: string, password: string) {
    userData.username = username;
    userData.password = password;

    // 保存本地
    window.localStorage.setItem("userData", JSON.stringify(userData));
  }

  return { userData, setLoginInfo };
});
